package com.dhj.streamTest2;

import com.dhj.streamTest.entity.Author;
import com.dhj.streamTest.entity.Book;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.dhj.streamTest.entity.AuthorList.getAuthors;

public class Demo5 {

    public static void main(String[] args) {
        List<Author> authors = getAuthors();

        boolean b = authors.stream().distinct().anyMatch(author -> author.getAge() > 50);
        System.out.println("是否有大于50岁的作者："+b);


        System.out.println("---------------------");

        boolean b1 = authors.stream().distinct().allMatch(author -> author.getAge() > 12);
        System.out.println("作者年龄是否都大于12岁："+b1);


        System.out.println("---------------------");

        boolean b2 = authors.stream().distinct().noneMatch(author -> author.getAge() > 75);
        System.out.println("作者的年龄是否都没有大于75："+b2);




    }
}
